#include "head.h"

int initStatus(status_t *status, int num){

    status->num = num;

    pthread_mutex_init(&status->lock, NULL);

    pthread_cond_init(&status->cond, NULL);

    memset(&status->queue, 0, sizeof(status->queue));

    status->thread_ids = (pthread_t *)calloc(num, sizeof(pthread_t));

    status->exitFlag = 0;
    for(int i=0; i<PTHREAD_COUNT; i++){
        pthread_create(&status->thread_ids[i], NULL, worker, (void *)status);
    }

    return 0;
}



int addEpoll(int epoll_fd, int fd){
    
    struct epoll_event event;
    event.events = EPOLLIN;
    event.data.fd = fd;
    epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &event);
}
